<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSV 处理服务</title>
    <style>
        body {
            font-family: sans-serif;
            display: flex;
            flex-direction: column;
            align-items: center;
            min-height: 100vh;
            background-color: #f0f0f0;
        }

        .content {
            background-color: #fff;
            padding: 2rem;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            margin-top: 2rem; /* 控制整体内容距离顶部的高度 */
            text-align: center; /* 居中内容 */
        }

        h1, h2 {
            color: #333;
        }

        form {
            display: flex;
            flex-direction: column;
            margin-bottom: 20px;
        }

        input[type="file"] {
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 5px;
            margin-bottom: 10px;
        }

        input[type="submit"] {
            padding: 10px 20px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }

        a {
            color: #007bff;
            text-decoration: none;
        }

        a:hover {
            text-decoration: underline;
        }

        /* 数据条目展示 */
        .database-entries {
            display: flex;
            flex-wrap: wrap; /* 自动换行 */
            justify-content: center; /* 居中 */
            gap: 1rem; /* 条目之间的间距 */
        }

        .database-entry {
            background-color: #eee;
            padding: 1rem;
            border-radius: 8px;
            width: 150px; /* 控制条目宽度 */
            text-align: center;
        }

        /* 高亮显示上传的条目 */
        .database-entry.highlighted {
            background-color: #c8e6c9; /* 浅绿色背景 */
        }
    </style>
</head>
<body>
    <div class="content">
        <h1>CSV 处理服务</h1>

        {% if message %}
            <p>{{ message }}</p>
        {% endif %}

        <h2>上传新的CSV文件</h2>
        <form method="POST" enctype="multipart/form-data">
            <input type="file" name="file">
            <input type="submit" value="上传">
        </form>

        <h2>已有的数据</h2>
        <div class="database-entries">
            {% for entry in database_entries %}
                <div class="database-entry {% if entry == highlighted_entry %}highlighted{% endif %}">
                    <a href="/orders/{{ entry }}">{{ entry }}</a>
                </div>
            {% endfor %}
        </div>
    </div>
</body>
</html>